<?php 
class Zendvn_Controller_Action_Helper_LayoutHelper extends Zend_Controller_Action_Helper_Abstract
{
    public function preDispatch()
    {
        $bootstrap = $this->getActionController()->getInvokeArg('bootstrap');
        $config = $bootstrap->getOptions();    
        $module = $this->getRequest()->getModuleName();
        if(isset($config[$module]['resources']['layout']['layout']))
        {
           $layoutScript = $config[$module]['resources']['layout']['layout'];           
           Zend_Layout::getMvcInstance()->setLayout($layoutScript);                  
        }
       if(isset($config[$module]['resources']['layout']['layoutPath']))
        {           
           $layoutPath = $config[$module]['resources']['layout']['layoutPath'];
           Zend_Layout::getMvcInstance()->setLayoutPath($layoutPath);           
        }        
    }
}
?>